package com.foton.bpc.all.remoting.netty.codec;

import java.util.List;

/**
 * @Author RenPu
 * @Date 2023/6/6 12:00
 * @Version 1.0
 * @Description: 定义编解码接口
 **/
public interface Codec {

    /**
     *  编码- java Object——————》byte[]  [客户端]
     * @param msg
     * @return
     * @throws Exception
     */
    byte[] encode(Object msg) throws Exception;


    /**
     * 解码- byte[]——————》Java Object  [服务端]
     * @param arg
     * @return
     * @throws Exception
     */
    List<Object> decode(byte[] arg) throws Exception;


    /**
     * 创建Codec对象实例
     * @return
     * @throws Exception
     */
    Codec creteInstance() throws Exception;


}
